<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>帮朋友写的一个生成码页面 | Dingzh's Blog</title><meta name="keywords" content="Web"><meta name="author" content="Dingzh"><meta name="copyright" content="Dingzh"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="朋友问我能不能写一个生成码逻辑，我想了想好像不难，由于要在全平台适用，干脆就直接用HTML写完事~"><meta property="og:type" content="article"><meta property="og:title" content="帮朋友写的一个生成码页面"><meta property="og:url" content="https://dingzh.cc/posts/b4104d32.html"><meta property="og:site_name" content="Dingzh&#39;s Blog"><meta property="og:description" content="朋友问我能不能写一个生成码逻辑，我想了想好像不难，由于要在全平台适用，干脆就直接用HTML写完事~"><meta property="og:locale" content="zh_CN"><meta property="og:image" content="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover272.jpg"><meta property="article:published_time" content="2022-02-17T11:55:32.000Z"><meta property="article:modified_time" content="2025-08-02T12:43:16.794Z"><meta property="article:author" content="Dingzh"><meta property="article:tag" content="Web"><meta name="twitter:card" content="summary"><meta name="twitter:image" content="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover272.jpg"><link rel="shortcut icon" href="https://alicdn.dingzh.cc/ding-BlogDemo/img/Favicon.png"><link rel="canonical" href="https://dingzh.cc/posts/b4104d32"><link rel="preconnect" href="//cdn.jsdelivr.net"><link rel="preconnect" href="//busuanzi.ibruce.info"><link rel="manifest" href="/manifest.json"><meta name="msapplication-TileColor" content="#f7cb98"><link rel="apple-touch-icon" sizes="180x180" href="https://alicdn.dingzh.cc/ding-BlogDemo/img/siteicon/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="https://alicdn.dingzh.cc/ding-BlogDemo/img/siteicon/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="https://alicdn.dingzh.cc/ding-BlogDemo/img/siteicon/favicon-16x16.png"><link rel="mask-icon" href="https://alicdn.dingzh.cc/ding-BlogDemo/img/siteicon/safari-pinned-tab.svg" color="#5bbad5"><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://npm.elemecdn.com/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload='this.media="all"'><link rel="stylesheet" href="https://npm.elemecdn.com/node-snackbar/dist/snackbar.min.css" media="print" onload='this.media="all"'><script>const GLOBAL_CONFIG={root:"/",algolia:void 0,localSearch:{path:"search.xml",languages:{hits_empty:"找不到您查询的内容：${query}"}},translate:void 0,noticeOutdate:void 0,highlight:{plugin:"highlighjs",highlightCopy:!0,highlightLang:!0,highlightHeightLimit:250},copy:{success:"复制成功",error:"复制错误",noSupport:"浏览器不支持"},relativeDate:{homepage:!1,post:!1},runtime:"天",date_suffix:{just:"刚刚",min:"分钟前",hour:"小时前",day:"天前",month:"个月前"},copyright:void 0,lightbox:"fancybox",Snackbar:{chs_to_cht:"你已切换为繁体",cht_to_chs:"你已切换为简体",day_to_night:"你已切换为深色模式",night_to_day:"你已切换为浅色模式",bgLight:"#ff6262",bgDark:"#7a3939",position:"top-center"},source:{jQuery:"https://npm.elemecdn.com/jquery@latest/dist/jquery.min.js",justifiedGallery:{js:"https://npm.elemecdn.com/justifiedGallery/dist/js/jquery.justifiedGallery.min.js",css:"https://npm.elemecdn.com/justifiedGallery/dist/css/justifiedGallery.min.css"},fancybox:{js:"https://alicdn.dingzh.cc/ding-BlogDemo/js/other/jquery.fancybox.min.js",css:"https://npm.elemecdn.com/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css"}},isPhotoFigcaption:!1,islazyload:!0,isanchor:!1}</script><script id="config-diff">var GLOBAL_CONFIG_SITE={title:"帮朋友写的一个生成码页面",isPost:!0,isHome:!1,isHighlightShrink:!1,isToc:!0,postUpdate:"2025-08-02 20:43:16"}</script><noscript><style>#nav{opacity:1}.justified-gallery img{opacity:1}#post-meta time,#recent-posts time{display:inline!important}</style></noscript><script>(e=>{e.saveToLocal={set:function(e,t,o){if(0===o)return;const n=864e5*o,a={value:t,expiry:(new Date).getTime()+n};localStorage.setItem(e,JSON.stringify(a))},get:function(e){const t=localStorage.getItem(e);if(!t)return;const o=JSON.parse(t);if(!((new Date).getTime()>o.expiry))return o.value;localStorage.removeItem(e)}},e.getScript=e=>new Promise((t,o)=>{const n=document.createElement("script");n.src=e,n.async=!0,n.onerror=o,n.onload=n.onreadystatechange=function(){const e=this.readyState;e&&"loaded"!==e&&"complete"!==e||(n.onload=n.onreadystatechange=null,t())},document.head.appendChild(n)}),e.activateDarkMode=function(){document.documentElement.setAttribute("data-theme","dark"),null!==document.querySelector('meta[name="theme-color"]')&&document.querySelector('meta[name="theme-color"]').setAttribute("content","#0d0d0d")},e.activateLightMode=function(){document.documentElement.setAttribute("data-theme","light"),null!==document.querySelector('meta[name="theme-color"]')&&document.querySelector('meta[name="theme-color"]').setAttribute("content","#ffffff")};const t=saveToLocal.get("theme"),o=(new Date).getHours();void 0===t?o<=6||o>=18?activateDarkMode():activateLightMode():"light"===t?activateLightMode():activateDarkMode();const n=saveToLocal.get("aside-status");void 0!==n&&("hide"===n?document.documentElement.classList.add("hide-aside"):document.documentElement.classList.remove("hide-aside"));const a=saveToLocal.get("global-font-size");void 0!==a&&document.documentElement.style.setProperty("--global-font-size",a+"px");const c=()=>{GLOBAL_CONFIG_SITE.isHome&&/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)&&document.documentElement.classList.add("apple")};c(),document.addEventListener("pjax:complete",c)})(window)</script><script defer src="https://alicdn.dingzh.cc/ding-BlogDemo/js/custom/randombg.min.js"></script><svg aria-hidden="true" style="position:absolute;overflow:hidden;width:0;height:0"><symbol id="icon-sun" viewBox="0 0 1024 1024"><path d="M960 512l-128 128v192h-192l-128 128-128-128H192v-192l-128-128 128-128V192h192l128-128 128 128h192v192z" fill="#FFD878" p-id="8420"></path><path d="M736 512a224 224 0 1 0-448 0 224 224 0 1 0 448 0z" fill="#FFE4A9" p-id="8421"></path><path d="M512 109.248 626.752 224H800v173.248L914.752 512 800 626.752V800h-173.248L512 914.752 397.248 800H224v-173.248L109.248 512 224 397.248V224h173.248L512 109.248M512 64l-128 128H192v192l-128 128 128 128v192h192l128 128 128-128h192v-192l128-128-128-128V192h-192l-128-128z" fill="#4D5152" p-id="8422"></path><path d="M512 320c105.888 0 192 86.112 192 192s-86.112 192-192 192-192-86.112-192-192 86.112-192 192-192m0-32a224 224 0 1 0 0 448 224 224 0 0 0 0-448z" fill="#4D5152" p-id="8423"></path></symbol><symbol id="icon-moon" viewBox="0 0 1024 1024"><path d="M611.370667 167.082667a445.013333 445.013333 0 0 1-38.4 161.834666 477.824 477.824 0 0 1-244.736 244.394667 445.141333 445.141333 0 0 1-161.109334 38.058667 85.077333 85.077333 0 0 0-65.066666 135.722666A462.08 462.08 0 1 0 747.093333 102.058667a85.077333 85.077333 0 0 0-135.722666 65.024z" fill="#FFB531" p-id="11345"></path><path d="M329.728 274.133333l35.157333-35.157333a21.333333 21.333333 0 1 0-30.165333-30.165333l-35.157333 35.157333-35.114667-35.157333a21.333333 21.333333 0 0 0-30.165333 30.165333l35.114666 35.157333-35.114666 35.157334a21.333333 21.333333 0 1 0 30.165333 30.165333l35.114667-35.157333 35.157333 35.157333a21.333333 21.333333 0 1 0 30.165333-30.165333z" fill="#030835" p-id="11346"></path></symbol></svg><link rel="stylesheet" href="https://alicdn.dingzh.cc/ding-BlogDemo/css/card.min.css" media="defer" onload='this.media="all"'><link rel="stylesheet" href="https://alicdn.dingzh.cc/ding-BlogDemo/clock/clock.min.css"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.css" media="print" onload='this.media="all"'><link rel="stylesheet" href="https://alicdn.dingzh.cc/ding-BlogDemo/css/swiperstyle.min.css" media="print" onload='this.media="all"'><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-wowjs/lib/animate.min.css" media="print" onload='this.media="screen"'><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-tag-plugins-plus@latest/lib/assets/font-awesome-animation.min.css" media="defer" onload='this.media="all"'><link rel="stylesheet" href="https://alicdn.dingzh.cc/ding-BlogDemo/css/tag_plugins.min.css" media="defer" onload='this.media="all"'><meta name="generator" content="Hexo 6.0.0"></head><body><a href="javascript:void(0);" onclick="preloader.endLoading()" title="点击跳过动画"><div id="loading-box"><div class="pokeball-back"></div><div class="pokeball-loading"><div class="pokeball" id="pokeball-normal"></div><div class="pokeball" id="pokeball-great"></div><div class="pokeball" id="pokeball-ultra"></div><div class="pokeball" id="pokeball-master"></div><div class="pokeball" id="pokeball-safari"></div></div></div></a><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://alicdn.dingzh.cc/ding-BlogDemo/img/head1.jpg" onerror='onerror=null,src="https://alicdn.dingzh.cc/ding-BlogDemo/img/imgLink_404.gif"' alt="avatar"></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">38</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">49</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">9</div></a></div></div></div><hr><div class="menus_items"><div class="menus_item"><a class="site-page faa-parent animated-hover" href="/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-shouye"></use></svg> <span>首页</span></a></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="javascript:void(0);"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-zixun"></use></svg> <span>文章</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/archives/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-danganku"></use></svg> <span>归档</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/tags/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-biaoqian"></use></svg> <span>标签</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/categories/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-wenjianjia"></use></svg> <span>分类</span></a></li></ul></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="javascript:void(0);"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-guochandonghuatuijian"></use></svg> <span>动漫</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/anime/tv/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-anime"></use></svg> <span>季度</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/anime/collect/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-a-vpszhujifuwuqiwangluo"></use></svg> <span>藏馆</span></a></li><li><a class="site-page child faa-parent animated-hover" target="_blank" rel="noopener" href="https://github.com/rplalala/MySubTittle"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-dianying"></use></svg> <span>字幕</span></a></li></ul></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="javascript:void(0);"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-a-switch2"></use></svg> <span>其他</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/gallery/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangce"></use></svg> <span>图库</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/artitalk/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-pinglun1"></use></svg> <span>随言</span></a></li></ul></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="/messageboard/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-rili"></use></svg> <span>留言板</span></a></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="javascript:void(0);"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-youqinglianjie"></use></svg> <span>链接</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/link/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-friendship"></use></svg> <span>友链</span></a></li><li><a class="site-page child faa-parent animated-hover" target="_blank" rel="noopener" href="https://vercel.dingzh.cc"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-a-internethulianwangwangluo"></use></svg> <span>镜像</span></a></li><li><a class="site-page child faa-parent animated-hover" href="https://dingzh.cc"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-a-vpszhujifuwuqiwangluo"></use></svg> <span>主站</span></a></li></ul></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="/about/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-wode2"></use></svg> <span>关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image:url(https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover272.jpg)"><nav id="nav"><span id="blog_name"><a id="site-name" onclick="btf.scrollToDest(0,500)" data-title="朋友问我能不能写一个生成码逻辑，我想了想好像不难，由于要在全平台适用，干脆就直接用HTML写完事~">帮朋友写的一个生成码页面</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search faa-parent animated-hover"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-sousuo4"></use></svg> <span>搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page faa-parent animated-hover" href="/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-shouye"></use></svg> <span>首页</span></a></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="javascript:void(0);"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-zixun"></use></svg> <span>文章</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/archives/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-danganku"></use></svg> <span>归档</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/tags/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-biaoqian"></use></svg> <span>标签</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/categories/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-wenjianjia"></use></svg> <span>分类</span></a></li></ul></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="javascript:void(0);"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-guochandonghuatuijian"></use></svg> <span>动漫</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/anime/tv/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-anime"></use></svg> <span>季度</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/anime/collect/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-a-vpszhujifuwuqiwangluo"></use></svg> <span>藏馆</span></a></li><li><a class="site-page child faa-parent animated-hover" target="_blank" rel="noopener" href="https://github.com/rplalala/MySubTittle"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-dianying"></use></svg> <span>字幕</span></a></li></ul></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="javascript:void(0);"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-a-switch2"></use></svg> <span>其他</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/gallery/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangce"></use></svg> <span>图库</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/artitalk/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-pinglun1"></use></svg> <span>随言</span></a></li></ul></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="/messageboard/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-rili"></use></svg> <span>留言板</span></a></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="javascript:void(0);"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-youqinglianjie"></use></svg> <span>链接</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/link/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-friendship"></use></svg> <span>友链</span></a></li><li><a class="site-page child faa-parent animated-hover" target="_blank" rel="noopener" href="https://vercel.dingzh.cc"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-a-internethulianwangwangluo"></use></svg> <span>镜像</span></a></li><li><a class="site-page child faa-parent animated-hover" href="https://dingzh.cc"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-a-vpszhujifuwuqiwangluo"></use></svg> <span>主站</span></a></li></ul></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="/about/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-wode2"></use></svg> <span>关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">帮朋友写的一个生成码页面<a class="post-edit-link" href="https://github.com/rplalala/BlogSource/edit/main/source/_posts/帮朋友写的一个生成码页面.md" title="编辑" target="_blank"><i class="fas fa-pencil-alt"></i></a></h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2022-02-17T11:55:32.000Z" title="发表于 2022-02-17 19:55:32">2022-02-17</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2025-08-02T12:43:16.794Z" title="更新于 2025-08-02 20:43:16">2025-08-02</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Web/">Web</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">1.7k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>9分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" data-flag-title="帮朋友写的一个生成码页面"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="具体逻辑"><a href="#具体逻辑" class="headerlink" title="具体逻辑"></a>具体逻辑</h1><ol><li>3段代码加1个随机数，3段代码不限制长度</li><li>若3段代码中包含英文字母，则最后的随机数以大写字母结尾</li><li>若3段代码是纯数字，则最后的随机数以数字结尾</li></ol><h1 id="实现"><a href="#实现" class="headerlink" title="实现"></a>实现</h1><p>由于想到啥写啥，所以逻辑其实很垃圾且为了方便全部集成在一个HTML文件下了。</p><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;!DOCTYPE <span class="meta-keyword">html</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">html</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">&quot;utf-8&quot;</span> /&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">title</span>&gt;</span>生成码<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">script</span> <span class="attr">type</span>=<span class="string">&quot;text/javascript&quot;</span>&gt;</span><span class="javascript"></span></span><br><span class="line"><span class="javascript">	</span></span><br><span class="line"><span class="javascript">		<span class="comment">//按下回车时，相当于按下生成按钮</span></span></span><br><span class="line"><span class="javascript">		<span class="built_in">document</span>.onkeydown=keyListener;</span></span><br><span class="line"><span class="javascript">		<span class="function"><span class="keyword">function</span> <span class="title">keyListener</span>(<span class="params">e</span>)</span>&#123;</span></span><br><span class="line"><span class="javascript">			<span class="comment">// 当按下回车键，执行我们的代码</span></span></span><br><span class="line"><span class="javascript">			<span class="keyword">if</span>(e.keyCode == <span class="number">13</span>)&#123;</span></span><br><span class="line"><span class="javascript">				generate();</span></span><br><span class="line"><span class="javascript">			&#125;</span></span><br><span class="line"><span class="javascript">		&#125;</span></span><br><span class="line"><span class="javascript">		</span></span><br><span class="line"><span class="javascript">		<span class="comment">// 复制字符串到剪切板</span></span></span><br><span class="line"><span class="javascript">		<span class="function"><span class="keyword">function</span> <span class="title">copyToClipboard</span>(<span class="params">elem</span>) </span>&#123;</span></span><br><span class="line"><span class="javascript">			<span class="comment">// create hidden text element, if it doesn&#x27;t already exist</span></span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> targetId = <span class="string">&quot;_hiddenCopyText_&quot;</span>;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> isInput = elem.tagName === <span class="string">&quot;INPUT&quot;</span> || elem.tagName === <span class="string">&quot;TEXTAREA&quot;</span>;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> origSelectionStart, origSelectionEnd;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">if</span> (isInput) &#123;</span></span><br><span class="line"><span class="javascript">				<span class="comment">// can just use the original source element for the selection and copy</span></span></span><br><span class="line"><span class="javascript">				target = elem;</span></span><br><span class="line"><span class="javascript">				origSelectionStart = elem.selectionStart;</span></span><br><span class="line"><span class="javascript">				origSelectionEnd = elem.selectionEnd;</span></span><br><span class="line"><span class="javascript">			&#125; <span class="keyword">else</span> &#123;</span></span><br><span class="line"><span class="javascript">				<span class="comment">// must use a temporary form element for the selection and copy</span></span></span><br><span class="line"><span class="javascript">				target = <span class="built_in">document</span>.getElementById(targetId);</span></span><br><span class="line"><span class="javascript">				<span class="keyword">if</span> (!target) &#123;</span></span><br><span class="line"><span class="javascript">					<span class="keyword">var</span> target = <span class="built_in">document</span>.createElement(<span class="string">&quot;textarea&quot;</span>);</span></span><br><span class="line"><span class="javascript">					target.style.position = <span class="string">&quot;absolute&quot;</span>;</span></span><br><span class="line"><span class="javascript">					target.style.left = <span class="string">&quot;-9999px&quot;</span>;</span></span><br><span class="line"><span class="javascript">					target.style.top = <span class="string">&quot;0&quot;</span>;</span></span><br><span class="line"><span class="javascript">					target.id = targetId;</span></span><br><span class="line"><span class="javascript">					<span class="built_in">document</span>.body.appendChild(target);</span></span><br><span class="line"><span class="javascript">				&#125;</span></span><br><span class="line"><span class="javascript">				target.textContent = elem.textContent;</span></span><br><span class="line"><span class="javascript">			&#125;</span></span><br><span class="line"><span class="javascript">			<span class="comment">// select the content</span></span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> currentFocus = <span class="built_in">document</span>.activeElement;</span></span><br><span class="line"><span class="javascript">			target.focus();</span></span><br><span class="line"><span class="javascript">			target.setSelectionRange(<span class="number">0</span>, target.value.length);</span></span><br><span class="line"><span class="javascript"></span></span><br><span class="line"><span class="javascript">			<span class="comment">// copy the selection</span></span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> succeed;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">try</span> &#123;</span></span><br><span class="line"><span class="javascript">				succeed = <span class="built_in">document</span>.execCommand(<span class="string">&quot;copy&quot;</span>);</span></span><br><span class="line"><span class="javascript">			&#125; <span class="keyword">catch</span> (e) &#123;</span></span><br><span class="line"><span class="javascript">				succeed = <span class="literal">false</span>;</span></span><br><span class="line"><span class="javascript">			&#125;</span></span><br><span class="line"><span class="javascript">			<span class="comment">// restore original focus</span></span></span><br><span class="line"><span class="javascript">			<span class="keyword">if</span> (currentFocus &amp;&amp; <span class="keyword">typeof</span> currentFocus.focus === <span class="string">&quot;function&quot;</span>) &#123;</span></span><br><span class="line"><span class="javascript">				currentFocus.focus();</span></span><br><span class="line"><span class="javascript">			&#125;</span></span><br><span class="line"><span class="javascript"></span></span><br><span class="line"><span class="javascript">			<span class="keyword">if</span> (isInput) &#123;</span></span><br><span class="line"><span class="javascript">				<span class="comment">// restore prior selection</span></span></span><br><span class="line"><span class="javascript">				elem.setSelectionRange(origSelectionStart, origSelectionEnd);</span></span><br><span class="line"><span class="javascript">			&#125; <span class="keyword">else</span> &#123;</span></span><br><span class="line"><span class="javascript">				<span class="comment">// clear temporary content</span></span></span><br><span class="line"><span class="javascript">				target.textContent = <span class="string">&quot;&quot;</span>;</span></span><br><span class="line"><span class="javascript">			&#125;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">return</span> succeed;</span></span><br><span class="line"><span class="javascript">		&#125;</span></span><br><span class="line"><span class="javascript"></span></span><br><span class="line"><span class="javascript">		<span class="comment">// 复制全部按钮事件</span></span></span><br><span class="line"><span class="javascript">		<span class="function"><span class="keyword">function</span> <span class="title">copy</span>(<span class="params"></span>) </span>&#123;</span></span><br><span class="line"><span class="javascript">			copyToClipboard(<span class="built_in">document</span>.getElementById(<span class="string">&quot;showText&quot;</span>));</span></span><br><span class="line"><span class="javascript">			alert(<span class="string">&quot;复制成功！&quot;</span>);</span></span><br><span class="line"><span class="javascript">		&#125;</span></span><br><span class="line"><span class="javascript"></span></span><br><span class="line"><span class="javascript">		<span class="comment">// 生成按钮事件</span></span></span><br><span class="line"><span class="javascript">		<span class="function"><span class="keyword">function</span> <span class="title">generate</span>(<span class="params"></span>) </span>&#123;</span></span><br><span class="line"><span class="javascript">			<span class="built_in">document</span>.getElementById(<span class="string">&quot;showText&quot;</span>).value = <span class="string">&quot;&quot;</span>;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> s1 = <span class="built_in">document</span>.getElementById(<span class="string">&quot;text1&quot;</span>).value;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> s2 = <span class="built_in">document</span>.getElementById(<span class="string">&quot;text2&quot;</span>).value;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> s3 = <span class="built_in">document</span>.getElementById(<span class="string">&quot;text3&quot;</span>).value;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> textbox = <span class="built_in">document</span>.getElementById(<span class="string">&quot;showText&quot;</span>);</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> limitDigit = <span class="keyword">new</span> <span class="built_in">RegExp</span>(<span class="string">&quot;^\\+?[1-9][0-9]*$&quot;</span>);<span class="comment">//正则</span></span></span><br><span class="line"><span class="javascript">			<span class="keyword">if</span> (limitDigit.test(s1) &amp;&amp; limitDigit.test(s2) &amp;&amp; limitDigit.test(s3)) &#123;</span></span><br><span class="line"><span class="javascript">				s3 = <span class="built_in">parseInt</span>(<span class="built_in">document</span>.getElementById(<span class="string">&quot;text3&quot;</span>).value);</span></span><br><span class="line"><span class="javascript">				<span class="keyword">for</span> (<span class="keyword">var</span> i = <span class="number">0</span>; i &lt; <span class="built_in">parseInt</span>(<span class="built_in">document</span>.getElementById(<span class="string">&quot;text4&quot;</span>).value); i++) &#123;</span></span><br><span class="line"><span class="javascript">					<span class="keyword">var</span> s4 = randomDigit(s1, s2, s3);</span></span><br><span class="line"><span class="javascript">					textbox.value = textbox.value + (s1 + s2 + s3 + s4 + <span class="string">&#x27;\n&#x27;</span>);</span></span><br><span class="line"><span class="javascript">					s3++;</span></span><br><span class="line"><span class="javascript">				&#125;</span></span><br><span class="line"><span class="javascript">			&#125; <span class="keyword">else</span> &#123;</span></span><br><span class="line"><span class="javascript">				<span class="keyword">var</span> chars = <span class="string">&quot;0123456789ABCDEFGHIZKLMNOPQRSTUVWXYZ&quot;</span>;</span></span><br><span class="line"><span class="javascript">				<span class="keyword">for</span> (<span class="keyword">var</span> i = <span class="number">0</span>; i &lt; <span class="built_in">parseInt</span>(<span class="built_in">document</span>.getElementById(<span class="string">&quot;text4&quot;</span>).value); i++) &#123;</span></span><br><span class="line"><span class="javascript">					<span class="keyword">var</span> s4 = chars.charAt(<span class="built_in">parseInt</span>(<span class="built_in">Math</span>.random() * <span class="number">36</span>));</span></span><br><span class="line"><span class="javascript">					textbox.value = textbox.value + (s1.toUpperCase() + s2.toUpperCase() + s3.toUpperCase() + s4 + <span class="string">&#x27;\n&#x27;</span>);</span></span><br><span class="line"><span class="javascript">					<span class="keyword">var</span> s3_10 = <span class="built_in">parseInt</span>(s3, <span class="number">36</span>);</span></span><br><span class="line"><span class="javascript">					s3 = (++s3_10).toString(<span class="number">36</span>);</span></span><br><span class="line"><span class="javascript">				&#125;</span></span><br><span class="line"><span class="javascript">			&#125;</span></span><br><span class="line"><span class="javascript">		&#125;</span></span><br><span class="line"><span class="javascript">		</span></span><br><span class="line"><span class="javascript">		<span class="comment">//重置按钮事件</span></span></span><br><span class="line"><span class="javascript">		<span class="function"><span class="keyword">function</span> <span class="title">reset</span>(<span class="params"></span>)</span>&#123;</span></span><br><span class="line"><span class="javascript">			<span class="built_in">document</span>.getElementById(<span class="string">&quot;text1&quot;</span>).value = <span class="string">&quot;&quot;</span>;</span></span><br><span class="line"><span class="javascript">			<span class="built_in">document</span>.getElementById(<span class="string">&quot;text2&quot;</span>).value = <span class="string">&quot;&quot;</span>;</span></span><br><span class="line"><span class="javascript">			<span class="built_in">document</span>.getElementById(<span class="string">&quot;text3&quot;</span>).value = <span class="string">&quot;&quot;</span>;</span></span><br><span class="line"><span class="javascript">			<span class="built_in">document</span>.getElementById(<span class="string">&quot;text4&quot;</span>).value = <span class="string">&quot;&quot;</span>;</span></span><br><span class="line"><span class="javascript">			<span class="built_in">document</span>.getElementById(<span class="string">&quot;showText&quot;</span>).value = <span class="string">&quot;&quot;</span>;</span></span><br><span class="line"><span class="javascript">		&#125;</span></span><br><span class="line"><span class="javascript"></span></span><br><span class="line"><span class="javascript">		<span class="comment">//纯数字时的尾数</span></span></span><br><span class="line"><span class="javascript">		<span class="function"><span class="keyword">function</span> <span class="title">randomDigit</span>(<span class="params">s_1, s_2, s3</span>) </span>&#123;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> pair = <span class="keyword">new</span> <span class="built_in">Array</span>();</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> single = <span class="keyword">new</span> <span class="built_in">Array</span>();</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> randomDigit = <span class="number">0</span>;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> n1 = s_1.length;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> n2 = s_2.length;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> n3 = (s3 + <span class="string">&quot;&quot;</span>).length;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> sumSingle = <span class="number">0</span>;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> sumPair = <span class="number">0</span>;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> sum = <span class="number">0</span>;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> s1 = <span class="built_in">parseInt</span>(s_1);</span></span><br><span class="line"><span class="javascript">			<span class="keyword">var</span> s2 = <span class="built_in">parseInt</span>(s_2);</span></span><br><span class="line"><span class="javascript">			<span class="keyword">for</span> (<span class="keyword">var</span> j = <span class="number">1</span>; j &lt;= n3; j++) &#123;</span></span><br><span class="line"><span class="javascript">				<span class="keyword">if</span> (j % <span class="number">2</span> != <span class="number">0</span>) &#123;</span></span><br><span class="line"><span class="javascript">					single.push(s3 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					s3 = <span class="built_in">parseInt</span>(s3 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">				&#125; <span class="keyword">else</span> &#123;</span></span><br><span class="line"><span class="javascript">					pair.push(s3 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					s3 = <span class="built_in">parseInt</span>(s3 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">				&#125;</span></span><br><span class="line"><span class="javascript">			&#125;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">if</span> (n3 % <span class="number">2</span> != <span class="number">0</span> &amp;&amp; n2 % <span class="number">2</span> != <span class="number">0</span>) &#123;</span></span><br><span class="line"><span class="javascript">				<span class="keyword">for</span> (<span class="keyword">var</span> j = <span class="number">1</span>; j &lt;= n2; j++) &#123;</span></span><br><span class="line"><span class="javascript">					<span class="keyword">if</span> (j % <span class="number">2</span> != <span class="number">0</span>) &#123;</span></span><br><span class="line"><span class="javascript">						pair.push(s2 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">						s2 = <span class="built_in">parseInt</span>(s2 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					&#125; <span class="keyword">else</span> &#123;</span></span><br><span class="line"><span class="javascript">						single.push(s2 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">						s2 = <span class="built_in">parseInt</span>(s2 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					&#125;</span></span><br><span class="line"><span class="javascript">				&#125;</span></span><br><span class="line"><span class="javascript">				<span class="keyword">for</span> (<span class="keyword">var</span> j = <span class="number">1</span>; j &lt;= n1; j++) &#123;</span></span><br><span class="line"><span class="javascript">					<span class="keyword">if</span> (j % <span class="number">2</span> != <span class="number">0</span>) &#123;</span></span><br><span class="line"><span class="javascript">						single.push(s1 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">						s1 = <span class="built_in">parseInt</span>(s1 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					&#125; <span class="keyword">else</span> &#123;</span></span><br><span class="line"><span class="javascript">						pair.push(s1 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">						s1 = <span class="built_in">parseInt</span>(s1 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					&#125;</span></span><br><span class="line"><span class="javascript">				&#125;</span></span><br><span class="line"><span class="javascript">			&#125; <span class="keyword">else</span> <span class="keyword">if</span> (n3 % <span class="number">2</span> != <span class="number">0</span> &amp;&amp; n2 % <span class="number">2</span> == <span class="number">0</span>) &#123;</span></span><br><span class="line"><span class="javascript">				<span class="keyword">for</span> (<span class="keyword">var</span> j = <span class="number">1</span>; j &lt;= n2; j++) &#123;</span></span><br><span class="line"><span class="javascript">					<span class="keyword">if</span> (j % <span class="number">2</span> != <span class="number">0</span>) &#123;</span></span><br><span class="line"><span class="javascript">						pair.push(s2 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">						s2 = <span class="built_in">parseInt</span>(s2 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					&#125; <span class="keyword">else</span> &#123;</span></span><br><span class="line"><span class="javascript">						single.push(s2 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">						s2 = <span class="built_in">parseInt</span>(s2 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					&#125;</span></span><br><span class="line"><span class="javascript">				&#125;</span></span><br><span class="line"><span class="javascript">				<span class="keyword">for</span> (<span class="keyword">var</span> j = <span class="number">1</span>; j &lt;= n1; j++) &#123;</span></span><br><span class="line"><span class="javascript">					<span class="keyword">if</span> (j % <span class="number">2</span> != <span class="number">0</span>) &#123;</span></span><br><span class="line"><span class="javascript">						pair.push(s1 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">						s1 = <span class="built_in">parseInt</span>(s1 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					&#125; <span class="keyword">else</span> &#123;</span></span><br><span class="line"><span class="javascript">						single.push(s1 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">						s1 = <span class="built_in">parseInt</span>(s1 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					&#125;</span></span><br><span class="line"><span class="javascript">				&#125;</span></span><br><span class="line"><span class="javascript">			&#125; <span class="keyword">else</span> <span class="keyword">if</span> (n3 % <span class="number">2</span> == <span class="number">0</span> &amp;&amp; n2 % <span class="number">2</span> != <span class="number">0</span>) &#123;</span></span><br><span class="line"><span class="javascript">				<span class="keyword">for</span> (<span class="keyword">var</span> j = <span class="number">1</span>; j &lt;= n2; j++) &#123;</span></span><br><span class="line"><span class="javascript">					<span class="keyword">if</span> (j % <span class="number">2</span> != <span class="number">0</span>) &#123;</span></span><br><span class="line"><span class="javascript">						single.push(s2 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">						s2 = <span class="built_in">parseInt</span>(s2 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					&#125; <span class="keyword">else</span> &#123;</span></span><br><span class="line"><span class="javascript">						pair.push(s2 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">						s2 = <span class="built_in">parseInt</span>(s2 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					&#125;</span></span><br><span class="line"><span class="javascript">				&#125;</span></span><br><span class="line"><span class="javascript">				<span class="keyword">for</span> (<span class="keyword">var</span> j = <span class="number">1</span>; j &lt;= n1; j++) &#123;</span></span><br><span class="line"><span class="javascript">					<span class="keyword">if</span> (j % <span class="number">2</span> != <span class="number">0</span>) &#123;</span></span><br><span class="line"><span class="javascript">						pair.push(s1 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">						s1 = <span class="built_in">parseInt</span>(s1 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					&#125; <span class="keyword">else</span> &#123;</span></span><br><span class="line"><span class="javascript">						single.push(s1 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">						s1 = <span class="built_in">parseInt</span>(s1 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					&#125;</span></span><br><span class="line"><span class="javascript">				&#125;</span></span><br><span class="line"><span class="javascript">			&#125; <span class="keyword">else</span> &#123;</span></span><br><span class="line"><span class="javascript">				<span class="keyword">for</span> (<span class="keyword">var</span> j = <span class="number">1</span>; j &lt;= n2; j++) &#123;</span></span><br><span class="line"><span class="javascript">					<span class="keyword">if</span> (j % <span class="number">2</span> != <span class="number">0</span>) &#123;</span></span><br><span class="line"><span class="javascript">						single.push(s2 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">						s2 = <span class="built_in">parseInt</span>(s2 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					&#125; <span class="keyword">else</span> &#123;</span></span><br><span class="line"><span class="javascript">						pair.push(s2 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">						s2 = <span class="built_in">parseInt</span>(s2 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					&#125;</span></span><br><span class="line"><span class="javascript">				&#125;</span></span><br><span class="line"><span class="javascript">				<span class="keyword">for</span> (<span class="keyword">var</span> j = <span class="number">1</span>; j &lt;= n1; j++) &#123;</span></span><br><span class="line"><span class="javascript">					<span class="keyword">if</span> (j % <span class="number">2</span> != <span class="number">0</span>) &#123;</span></span><br><span class="line"><span class="javascript">						single.push(s1 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">						s1 = <span class="built_in">parseInt</span>(s1 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					&#125; <span class="keyword">else</span> &#123;</span></span><br><span class="line"><span class="javascript">						pair.push(s1 % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">						s1 = <span class="built_in">parseInt</span>(s1 / <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">					&#125;</span></span><br><span class="line"><span class="javascript">				&#125;</span></span><br><span class="line"><span class="javascript">			&#125;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">for</span> (<span class="keyword">var</span> j = <span class="number">0</span>; j &lt; single.length; j++) &#123;</span></span><br><span class="line"><span class="javascript">				sumSingle += single[j];</span></span><br><span class="line"><span class="javascript">			&#125;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">for</span> (<span class="keyword">var</span> j = <span class="number">0</span>; j &lt; pair.length; j++) &#123;</span></span><br><span class="line"><span class="javascript">				sumPair += pair[j];</span></span><br><span class="line"><span class="javascript">			&#125;</span></span><br><span class="line"><span class="javascript">			sum = sumSingle * <span class="number">3</span> + sumPair;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">if</span> (sum % <span class="number">10</span> == <span class="number">0</span>) &#123;</span></span><br><span class="line"><span class="javascript">				randomDigit = <span class="number">0</span>;</span></span><br><span class="line"><span class="javascript">			&#125; <span class="keyword">else</span> &#123;</span></span><br><span class="line"><span class="javascript">				randomDigit = <span class="number">10</span> - (sum % <span class="number">10</span>);</span></span><br><span class="line"><span class="javascript">			&#125;</span></span><br><span class="line"><span class="javascript">			<span class="keyword">return</span> randomDigit;</span></span><br><span class="line"><span class="javascript">		&#125;</span></span><br><span class="line"><span class="javascript">	</span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">fieldset</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">legend</span> <span class="attr">align</span>=<span class="string">&quot;center&quot;</span>&gt;</span><span class="tag">&lt;<span class="name">h2</span>&gt;</span>生成码<span class="tag">&lt;/<span class="name">h2</span>&gt;</span><span class="tag">&lt;/<span class="name">legend</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">table</span> <span class="attr">border</span>=<span class="string">&quot;0&quot;</span> <span class="attr">cellspacing</span>=<span class="string">&quot;0&quot;</span> <span class="attr">cellpadding</span>=<span class="string">&quot;0&quot;</span> <span class="attr">align</span>=<span class="string">&quot;center&quot;</span>&gt;</span></span><br><span class="line">				<span class="tag">&lt;<span class="name">tr</span>&gt;</span></span><br><span class="line">					<span class="tag">&lt;<span class="name">td</span>&gt;</span><span class="symbol">&amp;nbsp;</span><span class="tag">&lt;<span class="name">label</span> <span class="attr">for</span>=<span class="string">&quot;text1&quot;</span>&gt;</span>国家代码：<span class="tag">&lt;/<span class="name">label</span>&gt;</span><span class="tag">&lt;/<span class="name">td</span>&gt;</span></span><br><span class="line">					<span class="tag">&lt;<span class="name">td</span>&gt;</span></span><br><span class="line">						<span class="comment">&lt;!-- 只允许输入数字和字母 --&gt;</span></span><br><span class="line">						<span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">&quot;text&quot;</span> <span class="attr">name</span>=<span class="string">&quot;text1&quot;</span> <span class="attr">id</span>=<span class="string">&quot;text1&quot;</span> <span class="attr">onkeyup</span>=<span class="string">&quot;value=value.replace(/[\W]/g,&#x27;&#x27;)&quot;</span></span></span><br><span class="line"><span class="tag">							<span class="attr">onbeforepaste</span>=<span class="string">&quot;clipboardData.setData(&#x27;text&#x27;,clipboardData.getData(&#x27;text&#x27;).replace(/[^\d]/g,&#x27;&#x27;))&quot;</span> /&gt;</span></span><br><span class="line">					<span class="tag">&lt;/<span class="name">td</span>&gt;</span></span><br><span class="line">					<span class="tag">&lt;<span class="name">td</span>&gt;</span><span class="symbol">&amp;nbsp;</span><span class="tag">&lt;<span class="name">label</span> <span class="attr">for</span>=<span class="string">&quot;text2&quot;</span>&gt;</span>厂商代码：<span class="tag">&lt;/<span class="name">label</span>&gt;</span><span class="tag">&lt;/<span class="name">td</span>&gt;</span></span><br><span class="line">					<span class="tag">&lt;<span class="name">td</span>&gt;</span></span><br><span class="line">						<span class="comment">&lt;!-- 只允许输入数字和字母 --&gt;</span></span><br><span class="line">						<span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">&quot;text&quot;</span> <span class="attr">name</span>=<span class="string">&quot;text2&quot;</span> <span class="attr">id</span>=<span class="string">&quot;text2&quot;</span> <span class="attr">onkeyup</span>=<span class="string">&quot;value=value.replace(/[\W]/g,&#x27;&#x27;)&quot;</span></span></span><br><span class="line"><span class="tag">							<span class="attr">onbeforepaste</span>=<span class="string">&quot;clipboardData.setData(&#x27;text&#x27;,clipboardData.getData(&#x27;text&#x27;).replace(/[^\d]/g,&#x27;&#x27;))&quot;</span> /&gt;</span></span><br><span class="line">					<span class="tag">&lt;/<span class="name">td</span>&gt;</span></span><br><span class="line">					<span class="tag">&lt;<span class="name">td</span>&gt;</span><span class="symbol">&amp;nbsp;</span><span class="tag">&lt;<span class="name">label</span> <span class="attr">for</span>=<span class="string">&quot;text3&quot;</span>&gt;</span>商品代码：<span class="tag">&lt;/<span class="name">label</span>&gt;</span><span class="tag">&lt;/<span class="name">td</span>&gt;</span></span><br><span class="line">					<span class="tag">&lt;<span class="name">td</span>&gt;</span></span><br><span class="line">						<span class="comment">&lt;!-- 只允许输入数字和字母 --&gt;</span></span><br><span class="line">						<span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">&quot;text&quot;</span> <span class="attr">name</span>=<span class="string">&quot;text3&quot;</span> <span class="attr">id</span>=<span class="string">&quot;text3&quot;</span> <span class="attr">onkeyup</span>=<span class="string">&quot;value=value.replace(/[\W]/g,&#x27;&#x27;)&quot;</span></span></span><br><span class="line"><span class="tag">							<span class="attr">onbeforepaste</span>=<span class="string">&quot;clipboardData.setData(&#x27;text&#x27;,clipboardData.getData(&#x27;text&#x27;).replace(/[^\d]/g,&#x27;&#x27;))&quot;</span> /&gt;</span></span><br><span class="line">					<span class="tag">&lt;/<span class="name">td</span>&gt;</span></span><br><span class="line">					<span class="tag">&lt;<span class="name">td</span>&gt;</span><span class="symbol">&amp;nbsp;</span><span class="tag">&lt;<span class="name">label</span> <span class="attr">for</span>=<span class="string">&quot;text4&quot;</span>&gt;</span>生成数量：<span class="tag">&lt;/<span class="name">label</span>&gt;</span><span class="tag">&lt;/<span class="name">td</span>&gt;</span></span><br><span class="line">					<span class="tag">&lt;<span class="name">td</span>&gt;</span></span><br><span class="line">						<span class="comment">&lt;!-- 只允许输入数字 --&gt;</span></span><br><span class="line">						<span class="tag">&lt;<span class="name">input</span> <span class="attr">name</span>=<span class="string">&quot;text4&quot;</span> <span class="attr">id</span>=<span class="string">&quot;text4&quot;</span> <span class="attr">type</span>=<span class="string">&quot;text&quot;</span> <span class="attr">onkeyup</span>=<span class="string">&quot;value=this.value.replace(/\D+/g,&#x27;&#x27;)&quot;</span> /&gt;</span></span><br><span class="line">					<span class="tag">&lt;/<span class="name">td</span>&gt;</span></span><br><span class="line">				<span class="tag">&lt;/<span class="name">tr</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;/<span class="name">table</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">div</span> <span class="attr">align</span>=<span class="string">&quot;center&quot;</span>&gt;</span></span><br><span class="line">				<span class="tag">&lt;<span class="name">br</span>&gt;</span></span><br><span class="line">				<span class="tag">&lt;<span class="name">textarea</span> <span class="attr">rows</span>=<span class="string">&quot;23&quot;</span> <span class="attr">cols</span>=<span class="string">&quot;102&quot;</span> <span class="attr">id</span>=<span class="string">&quot;showText&quot;</span> <span class="attr">style</span>=<span class="string">&quot;font-size: 18px; font-weight: bold;&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">textarea</span>&gt;</span></span><br><span class="line">				<span class="tag">&lt;<span class="name">br</span>&gt;</span><span class="tag">&lt;<span class="name">br</span>&gt;</span></span><br><span class="line">				<span class="comment">&lt;!-- 事件函数是generate() --&gt;</span></span><br><span class="line">				<span class="tag">&lt;<span class="name">button</span> <span class="attr">type</span>=<span class="string">&quot;button&quot;</span> <span class="attr">id</span>=<span class="string">&quot;generate&quot;</span> <span class="attr">onclick</span>=<span class="string">&quot;generate();&quot;</span>&gt;</span>生成<span class="tag">&lt;/<span class="name">button</span>&gt;</span></span><br><span class="line">				<span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span></span><br><span class="line">				<span class="comment">&lt;!-- 事件函数是reset() --&gt;</span></span><br><span class="line">				<span class="tag">&lt;<span class="name">button</span> <span class="attr">type</span>=<span class="string">&quot;button&quot;</span> <span class="attr">onclick</span>=<span class="string">&quot;reset();&quot;</span>&gt;</span>重置<span class="tag">&lt;/<span class="name">button</span>&gt;</span></span><br><span class="line">				<span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span><span class="symbol">&amp;nbsp;</span></span><br><span class="line">				<span class="comment">&lt;!-- 事件函数是copy() --&gt;</span></span><br><span class="line">				<span class="tag">&lt;<span class="name">button</span> <span class="attr">type</span>=<span class="string">&quot;button&quot;</span> <span class="attr">onclick</span>=<span class="string">&quot;copy();&quot;</span>&gt;</span>复制全部<span class="tag">&lt;/<span class="name">button</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;/<span class="name">fieldset</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br><span class="line"></span><br></pre></td></tr></table></figure></article><div class="post-copyright"><div class="post-copyright__title"><span class="post-copyright-info"><h>帮朋友写的一个生成码页面</h></span></div><div class="post-copyright__type"><span class="post-copyright-info"><a href="https://dingzh.cc/posts/b4104d32.html">https://dingzh.cc/posts/b4104d32.html</a></span></div><div class="post-copyright-m"><div class="post-copyright-m-info"><div class="post-copyright-a"><h>作者</h><div class="post-copyright-cc-info"><h>Dingzh</h></div></div><div class="post-copyright-c"><h>发布于</h><div class="post-copyright-cc-info"><h>2022-02-17</h></div></div><div class="post-copyright-u"><h>更新于</h><div class="post-copyright-cc-info"><h>2025-08-02</h></div></div><div class="post-copyright-c"><h>许可协议</h><div class="post-copyright-cc-info"><a class="icon" rel="noopener" target="_blank" title="Creative Commons" href="https://creativecommons.org/"><i class="fab fa-creative-commons"></i></a><a rel="noopener" target="_blank" title="CC BY-NC-SA 4.0" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a></div></div></div></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/Web/">Web</a></div><div class="post_share"><div class="social-share" data-image="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover272.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://npm.elemecdn.com/social-share.js/dist/css/share.min.css" media="print" onload='this.media="all"'><script src="https://npm.elemecdn.com/social-share.js/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button button--animated"><i class="fas fa-qrcode"></i> 打赏<div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="https://alicdn.dingzh.cc/ding-BlogDemo/img/wechat.jpg" target="_blank"><img class="post-qr-code-img" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/wechat.jpg" alt="微信"></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="https://alicdn.dingzh.cc/ding-BlogDemo/img/alipay.jpg" target="_blank"><img class="post-qr-code-img" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/alipay.jpg" alt="支付宝"></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/posts/2fafc5f1.html"><img class="prev-cover" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover284.jpg" onerror='onerror=null,src="https://alicdn.dingzh.cc/ding-BlogDemo/img/404_img.jpg"' alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">MySQL解决删除数据后，自增id的断层问题</div></div></a></div><div class="next-post pull-right"><a href="/posts/6993b31.html"><img class="next-cover" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover259.jpg" onerror='onerror=null,src="https://alicdn.dingzh.cc/ding-BlogDemo/img/404_img.jpg"' alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">VSCODE更换MarkDown样式，并分享自用样式</div></div></a></div></nav><hr><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i> <span>评论</span></div></div><div class="comment-wrap"><div><div id="twikoo-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://alicdn.dingzh.cc/ding-BlogDemo/img/head1.jpg" onerror='this.onerror=null,this.src="https://alicdn.dingzh.cc/ding-BlogDemo/img/imgLink_404.gif"' alt="avatar"></div><div class="author-info__name">Dingzh</div><div class="author-info__description">为之则易，不为则难</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">38</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">标签</div><div class="length-num">49</div></a></div><div class="card-info-data-item is-center"><a href="/categories/"><div class="headline">分类</div><div class="length-num">9</div></a></div></div><a class="button--animated" id="card-info-btn" href="javascript:void(0)" onclick="addFav()"><i class="fas fa-star"></i><span>收藏本站</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/rplalala" target="_blank" title="Github"><i class="fab iconfont icon-github"></i></a><a class="social-icon" href="https://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&amp;email=dingzihang00@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a><a class="social-icon" href="https://gitee.com/rplalala" target="_blank" title="Gitee"><i class="fab iconfont icon-gitee-fill-round"></i></a><a class="social-icon" href="https://blog.csdn.net/RP123123123?spm=1000.2115.3001.5343" target="_blank" title="CSDN"><i class="fab iconfont icon-csdn1-copy"></i></a><a class="social-icon" href="https://leetcode-cn.com/u/dingzihang00/" target="_blank" title="LeetCode"><i class="fab iconfont icon-leetcode"></i></a><a class="social-icon" href="https://space.bilibili.com/6964209" target="_blank" title="Bilibili"><i class="fab iconfont icon-bilibili-fill"></i></a><a class="social-icon" href="https://i.y.qq.com/n2/m/share/details/taoge.html?id=3885764921" target="_blank" title="QQ音乐"><i class="fab iconfont icon-QQyinle"></i></a></div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%85%B7%E4%BD%93%E9%80%BB%E8%BE%91"><span class="toc-number">1.</span> <span class="toc-text">具体逻辑</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%AE%9E%E7%8E%B0"><span class="toc-number">2.</span> <span class="toc-text">实现</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/posts/b6ddf346.html" title="leetcode hot 100 刷题笔记"><img src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover258.jpg" onerror='this.onerror=null,this.src="https://alicdn.dingzh.cc/ding-BlogDemo/img/404_img.jpg"' alt="leetcode hot 100 刷题笔记"></a><div class="content"><a class="title" href="/posts/b6ddf346.html" title="leetcode hot 100 刷题笔记">leetcode hot 100 刷题笔记</a><time datetime="2025-11-17T10:40:06.000Z" title="发表于 2025-11-17 18:40:06">2025-11-17</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/5b98c3b1.html" title="纯JWT TOKEN 和Redis + JWT TOKEN的区别和应用场景"><img src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover122.jpg" onerror='this.onerror=null,this.src="https://alicdn.dingzh.cc/ding-BlogDemo/img/404_img.jpg"' alt="纯JWT TOKEN 和Redis + JWT TOKEN的区别和应用场景"></a><div class="content"><a class="title" href="/posts/5b98c3b1.html" title="纯JWT TOKEN 和Redis + JWT TOKEN的区别和应用场景">纯JWT TOKEN 和Redis + JWT TOKEN的区别和应用场景</a><time datetime="2025-11-16T16:24:56.000Z" title="发表于 2025-11-17 00:24:56">2025-11-17</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/14f08eda.html" title="RAG / MCP / Prompt 和一些常用的 Agent 框架"><img src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover155.jpg" onerror='this.onerror=null,this.src="https://alicdn.dingzh.cc/ding-BlogDemo/img/404_img.jpg"' alt="RAG / MCP / Prompt 和一些常用的 Agent 框架"></a><div class="content"><a class="title" href="/posts/14f08eda.html" title="RAG / MCP / Prompt 和一些常用的 Agent 框架">RAG / MCP / Prompt 和一些常用的 Agent 框架</a><time datetime="2025-11-11T12:46:47.000Z" title="发表于 2025-11-11 20:46:47">2025-11-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/7a10715.html" title="什么是 MCP，什么是 MCP Server"><img src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover16.jpg" onerror='this.onerror=null,this.src="https://alicdn.dingzh.cc/ding-BlogDemo/img/404_img.jpg"' alt="什么是 MCP，什么是 MCP Server"></a><div class="content"><a class="title" href="/posts/7a10715.html" title="什么是 MCP，什么是 MCP Server">什么是 MCP，什么是 MCP Server</a><time datetime="2025-11-11T08:05:27.000Z" title="发表于 2025-11-11 16:05:27">2025-11-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/1383d4dc.html" title="阿里云CDN 配置国内外双源站策略，加快国内外访问"><img src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover39.jpg" onerror='this.onerror=null,this.src="https://alicdn.dingzh.cc/ding-BlogDemo/img/404_img.jpg"' alt="阿里云CDN 配置国内外双源站策略，加快国内外访问"></a><div class="content"><a class="title" href="/posts/1383d4dc.html" title="阿里云CDN 配置国内外双源站策略，加快国内外访问">阿里云CDN 配置国内外双源站策略，加快国内外访问</a><time datetime="2025-11-09T17:28:32.000Z" title="发表于 2025-11-10 01:28:32">2025-11-10</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright"><span>&copy;2021 - 2025</span><svg style="width:1.5em;height:1.5em" aria-hidden="true"><use xlink:href="#icon-diqiu"></use></svg><span>Dingzh</span></div><div class="footer_custom_text"><span id="timeShow"></span></div><p id="ghbdages"><a class="github-badge" target="_blank" href="https://github.com/rplalala/rplalala.github.io" style="margin-inline:5px"><img src="https://img.shields.io/badge/Source-Github-d021d6?style=flat&amp;logo=GitHub" title="本站项目由Github托管"></a><a class="github-badge" target="_blank" href="https://gitee.com/rplalala/rplalala" style="margin-inline:5px"><img src="https://img.shields.io/badge/Mirror-Gitee-0cedbe?style=flat&amp;logo=Gitee" title="本站国内镜像由Gitee托管"></a><a class="github-badge" target="_blank" href="https://vercel.com/" style="margin-inline:5px"><img src="https://img.shields.io/badge/Hosted-Vercel-brightgreen?style=flat&amp;logo=Vercel" title="本站采用双线部署，默认线路托管于Vercel"></a><a class="github-badge" target="_blank" href="https://www.aliyun.com/" style="margin-inline:5px"><img src="https://img.shields.io/badge/CDN-Aliyun-orange?style=flat&amp;logo=AlibabaCloud" title="本站使用阿里云提供CDN加速"></a><a class="github-badge" target="_blank" href="https://beian.miit.gov.cn/" style="margin-inline:5px"><img src="https://img.shields.io/badge/%E9%97%BDICP%E5%A4%87-2022001031%E5%8F%B7-e1d492?style=flat&amp;logo=" title="本站已在工信部备案，备案号闽ICP备-2022001031号"></a><a class="github-badge" target="_blank" href="https://icp.gov.moe/?keyword=20221220" style="margin-inline:5px"><img src="https://img.shields.io/badge/%E8%90%8CICP%E5%A4%87-20221220%E5%8F%B7-fe1384?style-flat&amp;logo=" title="本站已加入萌ICP备，萌号萌ICP备-20221220号"></a><a class="github-badge" target="_blank" href="https://creativecommons.org/licenses/by-nc-sa/4.0/" style="margin-inline:5px"><img src="https://img.shields.io/badge/Copyright-BY--NC--SA%204.0-d42328?style=flat&amp;logo=Claris" title="本站采用知识共享署名-非商业性使用-相同方式共享4.0国际许可协议进行许可"></a><a class="github-badge" target="_blank" href="https://butterfly.js.org/" style="margin-inline:5px"><img src="https://img.shields.io/badge/Theme-Butterfly-6513df?style=flat&amp;logo=bitdefender" title="主题版本为Butterfly_v3.8.4"></a><a class="github-badge" target="_blank" href="https://hexo.io/" style="margin-inline:5px"><img src="https://img.shields.io/badge/Frame-Hexo-blue?style=flat&amp;logo=hexo" title="博客框架为Hexo_v6.0.0"></a></p></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="font-plus" type="button" title="放大字体"><i class="fas fa-plus"></i></button><button id="font-minus" type="button" title="缩小字体"><i class="fas fa-minus"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><a class="icon-V hidden" onclick="switchNightMode()" title="浅色和深色模式转换"><svg width="25" height="25" viewBox="0 0 1024 1024"><use id="modeicon" xlink:href="#icon-moon"></use></svg></a><button id="change-bg-btn" type="button" title="更换背景" onclick="(function(b){var i=b.querySelector('i');if(i)i.classList.add('fa-spin');b.disabled=true;Promise.resolve(window.changeBackground &amp;&amp; changeBackground()).catch(function(e){try{console.error(e)}catch(e){}}).then(function(){if(i)i.classList.remove('fa-spin');b.disabled=false;});})(this)"><i class="fas fa-image"></i></button><button id="cycle-bg-mode-btn" type="button" title="背景模式" data-title-base="背景模式" data-random-label="随机背景" data-white-label="纯白背景" data-black-label="纯黑背景" onclick="window.cycleBackgroundMode &amp;&amp; cycleBackgroundMode(this)"><i class="fas fa-palette"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button><button id="to_comment" type="button" title="直达评论" onclick="FixedCommentBtn()"><i class="fas fa-comments"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"></div></div></div><hr><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="https://npm.elemecdn.com/jquery@latest/dist/jquery.min.js"></script><script src="https://alicdn.dingzh.cc/ding-BlogDemo/js/utils.min.js"></script><script src="https://alicdn.dingzh.cc/ding-BlogDemo/js/main.min.js"></script><script defer src="https://npm.elemecdn.com/instant.page/instantpage.js" type="module"></script><script src="https://npm.elemecdn.com/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script defer src="https://npm.elemecdn.com/node-snackbar/dist/snackbar.min.js"></script><script>function panguFn(){"object"==typeof pangu?pangu.autoSpacingPage():getScript("https://alicdn.dingzh.cc/ding-BlogDemo/js/other/pangu.min.js").then(()=>{pangu.autoSpacingPage()})}function panguInit(){panguFn()}document.addEventListener("DOMContentLoaded",panguInit)</script><script defer src="https://alicdn.dingzh.cc/ding-BlogDemo/js/search/local-search.min.js"></script><script async>var preloader={endLoading:()=>{document.body.style.overflow="auto",document.getElementById("loading-box").classList.add("loaded")},initLoading:()=>{document.body.style.overflow="",document.getElementById("loading-box").classList.remove("loaded")}};window.addEventListener("load",()=>{preloader.endLoading()}),setTimeout((function(){preloader.endLoading()}),2500)</script><div class="js-pjax"><script>(()=>{const t=document.getElementById("twikoo-count"),o=()=>{twikoo.init(Object.assign({el:"#twikoo-wrap",envId:"https://twikoo.dingzh.cc/",region:""},null))},n=()=>{twikoo.getCommentsCount({envId:"https://twikoo.dingzh.cc/",region:"",urls:[window.location.pathname],includeReply:!1}).then((function(o){t.innerText=o[0].count})).catch((function(t){console.error(t)}))},e=(e=!1)=>{"object"==typeof twikoo?(o(),e&&t&&setTimeout(n,0)):getScript("https://alicdn.dingzh.cc/ding-BlogDemo/js/other/twikoo.all.min.js").then(()=>{o(),e&&t&&setTimeout(n,0)})};btf.loadComment(document.getElementById("twikoo-wrap"),e)})()</script></div><script>window.addEventListener("load",()=>{const e=e=>{let t="";if(e.length)for(let n=0;n<e.length;n++){t+="<div class='aside-list-item'>";{const a="data-lazy-src";t+=`<a href='${e[n].url}' class='thumbnail'><img ${a}='${e[n].avatar}' alt='${e[n].nick}'></a>`}t+=`<div class='content'>\n        <a class='comment' href='${e[n].url}'>${e[n].content}</a>\n        <div class='name'><span>${e[n].nick} / </span><time datetime="${e[n].date}">${btf.diffDate(e[n].date,!0)}</time></div>\n        </div></div>`}else t+="没有评论";let n=document.querySelector("#card-newest-comments .aside-list");n.innerHTML=t,window.lazyLoadInstance&&window.lazyLoadInstance.update(),window.pjax&&window.pjax.refresh(n)},t=()=>{if(document.querySelector("#card-newest-comments .aside-list")){const t=saveToLocal.get("twikoo-newest-comments");t?e(JSON.parse(t)):(()=>{const t=()=>{twikoo.getRecentComments({envId:"https://twikoo.dingzh.cc/",region:"",pageSize:6,includeReply:!0}).then((function(t){const n=t.map(e=>{return{content:(t=e.comment,""===t||(t=(t=(t=(t=t.replace(/<img.*?src="(.*?)"?[^\>]+>/gi,"[图片]")).replace(/<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi,"[链接]")).replace(/<pre><code>.*?<\/pre>/gi,"[代码]")).replace(/<[^>]+>/g,"")).length>150&&(t=t.substring(0,150)+"..."),t),avatar:e.avatar,nick:e.nick,url:e.url+"#"+e.id,date:new Date(e.created).toISOString()};var t});saveToLocal.set("twikoo-newest-comments",JSON.stringify(n),10/1440),e(n)})).catch((function(e){document.querySelector("#card-newest-comments .aside-list").innerHTML="无法获取评论，请确认相关配置是否正确"}))};"object"==typeof twikoo?t():getScript("https://alicdn.dingzh.cc/ding-BlogDemo/js/other/twikoo.all.min.js").then(t)})()}};t(),document.addEventListener("pjax:complete",t)})</script><script async src="https://alicdn.dingzh.cc/ding-BlogDemo/js/custom/myJS.min.js"></script><script async src="https://at.alicdn.com/t/font_3113985_v9z1ah1pbeo.js"></script><script async src="https://at.alicdn.com/t/font_2032782_ev6ytrh30f.js"></script><script defer src="https://alicdn.dingzh.cc/ding-BlogDemo/js/custom/baidu_sub.min.js"></script><script data-pjax defer src="https://alicdn.dingzh.cc/ding-BlogDemo/js/custom/fixed_card_widget.min.js"></script><script data-pjax defer src="https://alicdn.dingzh.cc/ding-BlogDemo/js/custom/fixedComment_twikoo.min.js"></script><script src="https://alicdn.dingzh.cc/ding-BlogDemo/js/custom/sun_moon.min.js" async></script><script src="https://npm.elemecdn.com/butterfly-extsrc@1/dist/activate-power-mode.min.js"></script><script>POWERMODE.colorful=!0,POWERMODE.shake=!1,POWERMODE.mobile=!1,document.body.addEventListener("input",POWERMODE)</script><script id="click-heart" src="https://npm.elemecdn.com/butterfly-extsrc@1/dist/click-heart.min.js" async mobile="false"></script><script src="https://npm.elemecdn.com/pjax/pjax.min.js"></script><script>let pjaxSelectors=["title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show","#fixedcard-dashboard",".js-pjax"];var pjax=new Pjax({elements:'a:not([target="_blank"])',selectors:pjaxSelectors,cacheBust:!1,analytics:!1,scrollRestoration:!1});document.addEventListener("pjax:send",(function(){if(window.removeEventListener("scroll",window.tocScrollFn),window.removeEventListener("scroll",scrollCollect),"object"==typeof preloader&&preloader.initLoading(),window.aplayers)for(let e=0;e<window.aplayers.length;e++)window.aplayers[e].options.fixed||window.aplayers[e].destroy();"object"==typeof typed&&typed.destroy();const e=document.body.classList;e.contains("read-mode")&&e.remove("read-mode")})),document.addEventListener("pjax:complete",(function(){window.refreshFn(),document.querySelectorAll("script[data-pjax]").forEach(e=>{const t=document.createElement("script"),o=e.text||e.textContent||e.innerHTML||"";Array.from(e.attributes).forEach(e=>t.setAttribute(e.name,e.value)),t.appendChild(document.createTextNode(o)),e.parentNode.replaceChild(t,e)}),GLOBAL_CONFIG.islazyload&&window.lazyLoadInstance.update(),"function"==typeof chatBtnFn&&chatBtnFn(),"function"==typeof panguInit&&panguInit(),"function"==typeof gtag&&gtag("config","",{page_path:window.location.pathname}),"object"==typeof _hmt&&_hmt.push(["_trackPageview",window.location.pathname]),"object"==typeof Prism&&Prism.highlightAll(),"object"==typeof preloader&&preloader.endLoading()})),document.addEventListener("pjax:error",e=>{404===e.request.status&&pjax.loadUrl("/404.html")})</script><script async data-pjax src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="fixedcard-dashboard"><button class="fixedcard-activebtn" type="button" title="用户信息" onclick="FixedCardWidget(&quot;class&quot;,&quot;card-info&quot;,&quot;0&quot;)"><i class="fas fa-address-book"></i></button><button class="fixedcard-activebtn" type="button" title="电子钟" onclick="FixedCardWidget(&quot;class&quot;,&quot;card-clock&quot;,&quot;0&quot;)"><i class="fas fa-cloud-sun"></i></button><button class="fixedcard-activebtn" type="button" title="最新文章" onclick="FixedCardWidget(&quot;class&quot;,&quot;card-recent-post&quot;,&quot;0&quot;)"><i class="fas fa-history"></i></button><div class="fixedcard-user-avatar fixedcard-activebtn" onclick="RemoveFixedCardWidget()"><img class="fixedcard-user-avatar-img" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/head1.jpg" title="Dingzh"></div></div><div class="app-refresh" id="app-refresh" style="position:fixed;top:-2.2rem;left:0;right:0;z-index:99999;padding:0 1rem;font-size:15px;height:2.2rem;transition:all .3s ease"><div class="app-refresh-wrap" style="display:flex;color:#fff;height:100%;align-items:center;justify-content:center"><label>🌈本站有新文章啦💌</label><a href="javascript:void(0)" onclick='top.location.href="/"'><span style="color:#fff;text-decoration:underline;cursor:pointer">🔎查看🤗</span></a></div></div><script>function showNotification(){if(GLOBAL_CONFIG.Snackbar){var t="light"===document.documentElement.getAttribute("data-theme")?GLOBAL_CONFIG.Snackbar.bgLight:GLOBAL_CONFIG.Snackbar.bgDark,e=GLOBAL_CONFIG.Snackbar.position;Snackbar.show({text:"🌈本站有新文章啦💌",backgroundColor:t,duration:5e5,pos:e,actionText:"🔎查看🤗",actionTextColor:"#fff",onActionClick:function(t){top.location.href="/"}})}else{var o=`top: 0; background: ${"light"===document.documentElement.getAttribute("data-theme")?"#49b1f5":"#1f1f1f"};`;document.getElementById("app-refresh").style.cssText=o}}"serviceWorker"in navigator&&(navigator.serviceWorker.controller&&navigator.serviceWorker.addEventListener("controllerchange",(function(){showNotification()})),window.addEventListener("load",(function(){navigator.serviceWorker.register("/sw.js")})))</script></div><script data-pjax>function card_artitalk_injector_config(){var a=document.getElementsByClassName("sticky_layout")[0];console.log("已挂载card_artitalk"),a.insertAdjacentHTML("afterbegin",'<div class="card-widget card-shuo"><div class="card-content" style="height:auto;min-height:280px;"><div class="item-headline"><i class="fas fa-comments"></i><span><a href="/artitalk/" title="artitalk page link">随言</a></span><a id="cardVisual" style="cursor:pointer;float:right" onclick="cardVisual()">编辑</a></div><div id="artitalk_main" style="width:100%;height:100%;padding:1px"></div></div></div>'),(()=>{const a=()=>{new Artitalk(Object.assign({appId:"5EG25co78od7O4GsnIcIySD9-MdYXbMMI",appKey:"e8zuU9tM3oRrN9kp9PWQwmYW"},{serverURL:"https://talkapi.dingzh.cc",lang:"zh",pageSize:1,color1:"#ff6262",color2:"#00a9c4",atEmoji:null}))};"function"==typeof Artitalk?a():getScript("https://npm.elemecdn.com/artitalk").then(a)})()}for(var elist="/artitalk/,/posts/".split(","),cpage=location.pathname,epage="/",flag=0,i=0;i<elist.length;i++)cpage.includes(elist[i])&&flag++;("all"===epage&&0==flag||epage===cpage)&&card_artitalk_injector_config()</script><script async src="https://alicdn.dingzh.cc/ding-BlogDemo/js/other/card_visual.min.js"></script><script data-pjax>function butterfly_clock_anzhiyu_injector_config(){var a=document.getElementsByClassName("sticky_layout")[0];console.log("已挂载butterfly_clock_anzhiyu"),a&&a.insertAdjacentHTML("afterbegin",'<div class="card-widget card-clock"><div class="card-glass"><div class="card-background"><div class="card-content"><div id="hexo_electric_clock"><img class="entered loading" id="card-clock-loading" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/loading.gif" style="height: 120px; width: 100%;" data-ll-status="loading"/></div></div></div></div></div>')}for(var elist="/archives/,/tags/,/categories/,/anime/,/gallery/,/artitalk/,/messageboard/,/link/,/about/".split(","),cpage=location.pathname,epage="all",qweather_key="dec7b69d45ab4dc4b9c3a6e8a13eb498",gaud_map_key="92c61ec107a5fc3b3abccc79ee948148",baidu_ak_key="undefined",flag=0,clock_rectangle="119.306239,26.075302",clock_default_rectangle_enable="false",i=0;i<elist.length;i++)cpage.includes(elist[i])&&flag++;("all"===epage&&0==flag||epage===cpage)&&butterfly_clock_anzhiyu_injector_config()</script><script src="https://pv.sohu.com/cityjson?ie=utf-8"></script><script data-pjax src="https://alicdn.dingzh.cc/ding-BlogDemo/clock/clock.min.js"></script><script data-pjax>function butterfly_swiper_injector_config(){var i=document.getElementsByClassName("recent-posts")[0];console.log("已挂载butterfly_swiper"),i.insertAdjacentHTML("afterbegin",'<div class="recent-post-item" style="height: auto;width: 100%"><div class="blog-slider swiper-container-fade swiper-container-horizontal" id="swiper_container"><div class="blog-slider__wrp swiper-wrapper" style="transition-duration: 0ms;"><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/d4e383e3.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover217.jpg" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2025-11-09</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/d4e383e3.html&quot;);" href="javascript:void(0);" alt="">对 AI Agent 的一些粗浅理解</a><div class="blog-slider__text">总结我目前 AI Agent 的一些粗浅理解</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/d4e383e3.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/b95b9d3f.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover186.jpg" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2025-10-28</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/b95b9d3f.html&quot;);" href="javascript:void(0);" alt="">AI Trip Assistant 复盘</a><div class="blog-slider__text">USYD 5620 小组项目AI Trip Assistant 复盘</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/b95b9d3f.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/7a10715.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover16.jpg" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2025-11-11</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/7a10715.html&quot;);" href="javascript:void(0);" alt="">什么是 MCP，什么是 MCP Server</a><div class="blog-slider__text">理解 MCP 协议及 MCP Server 的作用</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/7a10715.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/14f08eda.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover155.jpg" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2025-11-11</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/14f08eda.html&quot;);" href="javascript:void(0);" alt="">RAG / MCP / Prompt 和一些常用的 Agent 框架</a><div class="blog-slider__text">理解 RAG、MCP 和 Prompt 在 Agent 中的角色与区别，以及常用的 Agent 框架</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/14f08eda.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/8da89045.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover239.jpg" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-01-06</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/8da89045.html&quot;);" href="javascript:void(0);" alt="">seo优化超详细步骤 — hexo_butterfly</a><div class="blog-slider__text">搜索引擎收录博客详细步骤，并讲解如何对博客进行SEO优化</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/8da89045.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/b3f89ff3.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover117.jpg" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-01-05</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/b3f89ff3.html&quot;);" href="javascript:void(0);" alt="">JS、CSS异步加载优化方案</a><div class="blog-slider__text">拜读Akilar店长的文章后，自己对JS、CSS异步加载的总结与体会</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/b3f89ff3.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/b4caf892.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover131.jpg" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-01-07</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/b4caf892.html&quot;);" href="javascript:void(0);" alt="">部署博客中各种踩坑点记录</a><div class="blog-slider__text">部署博客也有半个月了，中间遇到了许多坑点，这里总结一下常规操作吧（其实也没多少，懒得写- -）。持续更新~</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/b4caf892.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div></div><div class="blog-slider__pagination swiper-pagination-clickable swiper-pagination-bullets"></div></div></div>')}for(var elist="undefined".split(","),cpage=location.pathname,epage="/",flag=0,i=0;i<elist.length;i++)cpage.includes(elist[i])&&flag++;("all"===epage&&0==flag||epage===cpage)&&butterfly_swiper_injector_config()</script><script defer src="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.js"></script><script defer data-pjax src="https://alicdn.dingzh.cc/ding-BlogDemo/js/other/swiper_init.min.js"></script><div class="js-pjax"><script async>for(var arr=document.getElementsByClassName("recent-post-item"),i=0;i<arr.length;i++)arr[i].classList.add("wow"),arr[i].classList.add("animate__fadeIn"),arr[i].setAttribute("data-wow-duration",""),arr[i].setAttribute("data-wow-delay",""),arr[i].setAttribute("data-wow-offset",""),arr[i].setAttribute("data-wow-iteration","")</script><script async>for(var arr=document.getElementsByClassName("card-widget"),i=0;i<arr.length;i++)arr[i].classList.add("wow"),arr[i].classList.add("animate__fadeIn"),arr[i].setAttribute("data-wow-duration",""),arr[i].setAttribute("data-wow-delay",""),arr[i].setAttribute("data-wow-offset",""),arr[i].setAttribute("data-wow-iteration","")</script><script async>for(var arr=document.getElementsByClassName("article-sort-item"),i=0;i<arr.length;i++)arr[i].classList.add("wow"),arr[i].classList.add("animate__fadeIn"),arr[i].setAttribute("data-wow-duration","1.2s"),arr[i].setAttribute("data-wow-delay",""),arr[i].setAttribute("data-wow-offset",""),arr[i].setAttribute("data-wow-iteration","")</script><script async>for(var arr=document.getElementsByClassName("flink-list-card"),i=0;i<arr.length;i++)arr[i].classList.add("wow"),arr[i].classList.add("animate__backInDown"),arr[i].setAttribute("data-wow-duration","1.2s"),arr[i].setAttribute("data-wow-delay",""),arr[i].setAttribute("data-wow-offset",""),arr[i].setAttribute("data-wow-iteration","")</script></div><script defer src="https://npm.elemecdn.com/hexo-butterfly-wowjs/lib/wow.min.js"></script><script defer src="https://npm.elemecdn.com/hexo-butterfly-wowjs/lib/wow_init.js"></script></body></html>